<?php
    $staff_id = $_GET['staff_id'];
    $sql = "SELECT staff_img FROM staff WHERE staff_id=$staff_id";
    $img_old = $db->Execute($sql);
    
    $sql = "DELETE FROM staff WHERE staff_id=$staff_id";
    $result = $db->Execute($sql);
    
    if($result){
        if(img_exists(APPPATH.'/images/staff',$img_old->fields['staff_img'])){
            @unlink(APPPATH.'/images/staff/'.$img_old->fields['staff_img']);
        }
        $msg = 'ลบข้อมูลเรียบร้อยแล้ว';
    }else{
        $msg = 'ไม่สามารถลบข้อมูลได้';
    }
?>

<?php
    include('header.php');
?>
<div class="grid_24" id="contents">
    <div id="query_result">
    <?php
        echo $msg , ' <img src="images/ajax-loader.gif" />';
        redirect('?m=about-us',3);
    ?>
    </div>
</div><!-- end .grid_18 -->
<div class="clear">&nbsp;</div>
<?php
    include('footer.php');
?>